<?php 
include_once('connection/connection.php');
include('header.php');
include('menu.php');
include('config.php');
$block=$_SESSION['form_id'];
$district=$_SESSION['district'];
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Source Sufficiency</title>
<style type="text/css">
.style10 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px; color:#000000}
.style11 {font-size: 9px}
</style>
</head>
<body>
<?php
//Select Data from lookup location table village wise
$sqlReport = "SELECT distinct block_name,village_id,village_name,census_village_code FROM tbl_lookup_location WHERE district_id='$district' and block_id='$block' order by village_name";
$queryReport = mysql_query($sqlReport);

//query for find Population factor of corresponding district
$sqlPopFactor="select population_factor from tbl_lookup_pop_factor where district_id='$district'";
$queryPopFactor= mysql_query($sqlPopFactor);
$rowPopFactor=mysql_fetch_array($queryPopFactor);
$population_factor=$rowPopFactor['population_factor'];

//find lpcd for district
if(($district == 389) || ($district ==390) || ($district == 391) || ($district ==392) || ($district == 401) || ($district == 402) || ($district == 403) || ($district == 404) || ($district == 405) || ($district == 406) || ($district == 416))
{
	$lpcd=70;
}
else
{
	$lpcd=40;
}

//Find no of HP and TW actual
function sourceType($habit_code,$name,$source)
			{
			$qrySource1="SELECT count(source_type) FROM tbl_dtls_q3_water_source_detail src,tbl_dtls_q3_water_source a where a.loc_id=src.loc_id and a.habitation_code='$habit_code' and src.habitation_name='$name' and src.functional_status='F' and src.source_type like '$source'";
               $recSource1=mysql_query($qrySource1);
               $rowSource1=mysql_fetch_row($recSource1);  
			   return $rowSource1[0];
			
			}
//Find village population
function VillPopulation($village_id)
			{
			$queryVillPopulation="SELECT sum(total_population) FROM tbl_lookup_location WHERE village_id='$village_id' ";
		    $ResultVillPopulation = mysql_query($queryVillPopulation);
			$VillPopulation = mysql_fetch_row($ResultVillPopulation);
			$villPopulation=$VillPopulation[0];	
			return $villPopulation;
			}
?>
<table border="0" width="2420" cellspacing="0" cellpadding="0">
	<tr>
		<td width="2420" height="26" bgcolor="#E9E9E9">
		<p align="center"><span style="font-size: 9pt; font-weight: 700">
	  <font face="Verdana" color="#224568">Source Sufficiency Report</font></span></td>
	</tr>
	<tr>
	  <td bgcolor="#E9E9E9" height="26"><div align="center"><font face="Verdana" style="font-size: 9pt; font-weight: 700" color="#224568">&nbsp;</font></div></td>
  </tr>
	
	<tr>
	  <td height="325"><table border="1" width="2418" cellspacing="0" cellpadding="0" height="260" bordercolor="#FFFFFF" style="border: 1px solid #BBD1E8" bgcolor="#F9F9F9">
        <tr bgcolor="#C5D8EB">
          <td width="40" rowspan="3" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Name of Block</font></td>
          <td width="56" rowspan="3" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Name of revenue Village</font></td>
          <td width="170" rowspan="3" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Name of Dhani's (Habitation)</font></td>
          <td width="51" rowspan="3" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Census Code (2001)</font></td>
          <td colspan="4" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Population</font></td>
          <td width="71" rowspan="3" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Coverage (500 m or 30 min distance)</font></td>
          <td colspan="2" rowspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">SC/ST Mohallas</font></td>
          <td colspan="2" rowspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Water Supply Scheme</font></td>
          <td colspan="6" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Infrastructure of WSS (TW/HP)</font></td>
          <td width="90" rowspan="3" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Whether the sources are Excess (+) or Short (-) as compared to Departmental norms</font></td>
          <td colspan="3" rowspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Water Supply (lpcd)</font></td>
          <td width="81" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Excess/Short (%)</span></font></td>
          <td colspan="3" rowspan="2" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Water Supply in SC/ST Habitation  (lpcd)</span></font></td>
          <td width="53" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Duration of Water Supply (hrs / day)</span></font></td>
          <td colspan="2" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Water Quality </span></font> </td>
          <td width="87" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Source Sustainanbility (% dependability of source)</span></font></td>
          <td colspan="3" rowspan="2" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Status of Household Security</span></font></td>
          <td width="127" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">If short, specific measures proposed to meet the norms</span></font></td>
          <td width="67" rowspan="3" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Remarks</span></font></td>
        </tr>
        <tr bgcolor="#C5D8EB">
          <td colspan="2" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">VILLAGE</span></font></td>
          <td colspan="2" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">HABITATION</span></font></td>
          <td colspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">HP</font></td>
          <td colspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">TW</font></td>
          <td colspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">SP</font></td>
          <td colspan="2" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">PHED</span></font></td>
        </tr>
        <tr bgcolor="#C5D8EB">
          <td width="28" height="114" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">2001</span></font></td>
          <td width="28" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">2010</span></font></td>
          <td width="43" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">2001</span></font></td>
          <td width="46" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">2010</span></font></td>
          <td width="41" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">SC/ST Bastis</font></td>
          <td width="85" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">SC/ST infrastructure</font></td>
          <td width="62" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Type of Scheme eligible to be covered as per PHED Policy</font></td>
          <td width="62" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Type of Scheme vide which covered</font></td>
          <td width="58" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Required</font></td>
          <td width="41" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Actual</font> </td>
          <td width="60" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Required</font></td>
          <td width="39" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Actual</font></td>
          <td width="60" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Required</font></td>
          <td width="39" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Actual</font></td>
          <td width="40" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">As per norms</font></td>
          <td width="43" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Actual </font> </td>
          <td width="48" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Excess (+), Short (-)</font></td>
          <td width="75" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">As per norms</span></font></td>
          <td width="65" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Actual </span></font> </td>
          <td width="114" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Excess (+), Short (-)</span></font></td>
          <td width="36" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">P</span></font></td>
          <td width="29" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">NP</span></font></td>
          <td width="82" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Fully Secure >100% </span></font></td>
          <td width="115" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Secure 50% to 100% </span></font></td>
          <td width="112" align="center"><font face="Verdana" color="#000000"> <span style="font-size: 8.5pt">Critical Below 25% </span></font></td>
        </tr>
        <tr>
          <td height="26" align="center"><span class="style10">1</span></td>
          <td align="center"><span class="style10">2</span></td>
          <td align="center"><span class="style10">3</span></td>
          <td align="center"><span class="style10">4</span></td>
          <td width="28" align="center"><span class="style10">5</span></td>
          <td width="28" align="center"><span class="style10">6</span></td>
          <td width="43" align="center"><span class="style10">7</span></td>
          <td width="46" align="center"><span class="style10">8</span></td>
          <td align="center"><span class="style10">9</span></td>
          <td align="center"><span class="style10">10</span></td>
          <td align="center"><span class="style10">11</span></td>
          <td align="center"><span class="style10">12</span></td>
          <td align="center"><span class="style10">13</span></td>
          <td align="center"><span class="style10">14</span></td>
          <td align="center"><span class="style10">15</span></td>
          <td align="center"><span class="style10">16</span></td>
          <td align="center"><span class="style10">17</span></td>
          <td align="center"><span class="style10">18</span></td>
          <td align="center"><span class="style10">19</span></td>
          <td align="center"><span class="style10">20</span></td>
          <td align="center"><span class="style10">21</span></td>
          <td align="center"><span class="style10">22</span></td>
          <td align="center"><span class="style10">23</span></td>
          <td align="center"><span class="style10">24</span></td>
          <td align="center"><span class="style10">25</span></td>
          <td align="center"><span class="style10">26</span></td>
          <td align="center"><span class="style10">27</span></td>
          <td align="center"><span class="style10">28</span></td>
          <td align="center"><span class="style10">29</span></td>
          <td align="center"><span class="style10">30</span></td>
          <td align="center"><span class="style10">31</span></td>
          <td align="center"><span class="style10">32</span></td>
          <td align="center"><span class="style10">33</span></td>
          <td align="center"><span class="style10">34</span></td>
          <td align="center"><span class="style10">35</span></td>
          <td align="center"><span class="style10">36</span></td>
        </tr>
        
        <?php
			
			while($rowReport = mysql_fetch_array($queryReport)) 
			{
			$block_name=$rowReport['block_name'];
			$village_id=$rowReport['village_id'];
			$village_name=$rowReport['village_name'];
			$cen_vill_code=$rowReport['census_village_code'];
		    $Vill_pop=VillPopulation($village_id);
			$current_vill_pop=round($Vill_pop*$population_factor);
$sqlScheme="SELECT type_scheme,duration_supply FROM tbl_dtls_q1_main main, tbl_dtls_q1_last last where  main.village_id='$village_id' and main.id=last.loc_id";
             $queryScheme=mysql_query($sqlScheme);
             $rowScheme=mysql_fetch_array($queryScheme);
			 $duration=$rowScheme['duration_supply'];
			 $schemeDetails=$rowScheme['type_scheme'];
			           if($schemeDetails !='HP')
			              {
			          $sqlScheme1="SELECT form_id FROM tbl_dtls_q2_main where village_id='$village_id'";
				      $queryScheme1=mysql_query($sqlScheme1);
				      $num_rows = mysql_num_rows($queryScheme1);
                            if($num_rows > 0)
				               {
			                     $schemeDetails="HP";
                               }
			              }	
//Query for finding RWSS scheme	
                      if($schemeDetails =='')
			              {		
			         $qryRwss="SELECT village_id FROM tbl_dtls_q1_main where block_id='$block'";
			         $queryRwss=mysql_query($qryRwss);
                          while($rowRwss=mysql_fetch_array($queryRwss))
			                    {
			                       //$rowRwss['village_id']."/".$village_id;
			            		   $vill = explode(",", $rowRwss['village_id']);
			                          if (in_array("$village_id", $vill)) 
				                          {
                                            $schemeDetails="RWSS";
                                          }
			                    }	
									
							}		   
// This is for column 16
		
			if($villPopulation <= 1500)
			{
				$column16="HP";
			}
			else if($villPopulation >=1501 and $villPopulation <= 4000)
			{
				$column16="P&T";
			}
			else if($villPopulation > 4000)
			{
				$column16="Piped";
			}
//end of column 16   
		?>
		
        <tr>
          <td height="26" align="center"><span class="style10"><?php echo $block_name;?></span></td>
          <td align="center"><span class="style10"><?php echo $village_name;?></span></td>
          <td align="center"><span class="style10">&nbsp;</td>
          <td align="center"><span class="style10"><?php echo $cen_vill_code;?></span></td>
          <td align="center"><span class="style10"><?php echo $Vill_pop;?></span></td>
          <td align="center"><span class="style10">
		   <?php 
				echo $current_vill_pop;
		   ?>
		   </span></td>
          <td colspan="3" align="center"><span class="style10">&nbsp;</span><span class="style10">&nbsp;</span><span class="style10">&nbsp;</span></td>
          <td align="center"><span class="style10">&nbsp;</span></td>
          <td align="center"><span class="style10">&nbsp;</span></td>
          <td align="center"><span class="style10"><?php echo $column16;?></span></td>
          <td align="center"><span class="style10"><?php echo $schemeDetails;?></span></td> 
		  <td colspan="6" align="center"><span class="style10">&nbsp;</span><span class="style10">&nbsp;</span><span class="style10">&nbsp;</span><span class="style10">&nbsp;</span><span class="style10">&nbsp;</span><span class="style10">&nbsp;</span></td>
          <td align="center"><span class="style10"><span class="style10"><?php
				if(($column16=="HP" && $schemeDetails=="HP") || ($column16=="P&T" && ($schemeDetails=="P&T" || $schemeDetails=="TSS(P&T)")) || ($column16=="Piped" && $schemeDetails=="Piped"))
				{
				echo "AS Per Norms";
				}
				if($column16=="HP" && ($schemeDetails=="P&T" || $schemeDetails=="Piped" || $schemeDetails=="RWSS" || $schemeDetails=="TSS(P&T)"))
				{
				echo "<font color='green'>EXCESS</font>";
				}
				if($column16=="P&T" && $schemeDetails=="HP")
				{
				echo "<font color='red'>SHORT</font>";
				}
				if($column16=="P&T" && $schemeDetails=="Piped")
				{
				echo "EXCESS";
				}
				if($column16=="Piped" && ($schemeDetails=="HP" || $schemeDetails=="P&T" || $schemeDetails=="TSS(P&T)"))
				{
				echo "<font color='red'>SHORT</font>";
				}
				?></span></span></td>
          <td colspan="7" align="center"><span class="style10">&nbsp;</span><span class="style10">&nbsp;</span><span class="style10">&nbsp;</span><span class="style10">&nbsp;</span><span class="style10">&nbsp;</span><span class="style10">&nbsp;</span><span class="style10">&nbsp;</span></td>
          <td align="center"><span class="style10"><span class="style10">
            <?php if ($column16 == 'HP'){ echo '24 Hrs';} else echo $duration;?>
          </span></span></td>
          <td align="center"><span class="style10">
<?php
	
	  $sqlSrc1="SELECT para_tds,para_cl,para_f,para_no3,bact FROM tbl_dtls_q3_water_source_detail src,tbl_dtls_q3_loc main where  main.village_id='$village_id' and main.id=src.loc_id ";
	  $querySrc1=mysql_query($sqlSrc1);
	  $p=0;$np=0;
	   while($rowSrc1=mysql_fetch_row($querySrc1))
			{
			
			$tds=$rowSrc1[0];
			$cl=$rowSrc1[1];
			$f=$rowSrc1[2];
			$no3=$rowSrc1[3];
			$bact=$rowSrc1[4];
 if(($district == 391) || ($district == 393) || ($district == 396) || ($district == 400) || ($district == 405) || ($district == 411) || ($district == 414))
	
	        {
	            
			   if(($tds < 3000) && ($cl < 1000) && ($f < 3) && ($no3 < 45) && ($bact == "no"))
			      {
				   $p=$p+1;
				  
			      }else{
				        $np=$np+1;
				       
				       }
			 }else
			   {
			     
			    if(($tds < 3000) && ($cl < 1000) && ($f < 3) && ($no3 < 45))
			      {
			       $p=$p+1;
				   //echo $p;
				  }else{
				        $np=$np+1;
				       
				       }
			   }
			   
			 }
			 echo $p;
?>

          </span></td>
          <td align="center"><span class="style10">
          <?php echo $np;?>		  
		  </span></td>
          <td align="center"><span class="style10">
		  <?php
		  if($schemeDetails == "HP")
		  {
		   $sqlDuration="SELECT * FROM tbl_dtls_q2_main where village_id='$village_id'";
           $queryDuration=mysql_query($sqlDuration);
           $rowDuration=mysql_fetch_array($queryDuration);
		   $duration=$rowDuration['OA_operational_status'];
		   if($duration == 12)
		   {
		   echo "100%";
		   }elseif($duration == 9)
		    {
			echo "75%";
			}elseif($duration == 6)
			 {
			 echo"50%";
			 }else{
			     echo"0%";
			      }
		  }elseif($schemeDetails == "Piped" || $schemeDetails == "P&T" || $schemeDetails == "RWSS")
		   {
		   $sqlStatus="SELECT * FROM tbl_dtls_q1_main main, tbl_dtls_q1_last last where main.village_id='$village_id' and main.id=last.loc_id";
           $queryStatus=mysql_query($sqlStatus);
           $rowStatus=mysql_fetch_array($queryStatus);
		   $Status=$rowStatus['current_status'];
		   if($Status == "operation")
		   {
		   echo "100%";
		   }elseif($Status == "defunct")
		    {
			echo "0%";
			}
		   }  
		  ?>
		  </span></td>
          <td colspan="3" align="center"><span class="style10">&nbsp;</span><span class="style10">&nbsp;</span><span class="style10">&nbsp;</span></td>
          <td align="center"><span class="style10">&nbsp;</span></td>
          <td align="center"><span class="style10">&nbsp;</span></td>
        </tr>
        <tr>
		<?php
//habitation basis village population and habitation population
$queryPopulation="SELECT total_population,sc_population,st_population,habitation_code,habitation_name FROM tbl_lookup_location WHERE village_id='$village_id' order by habitation_code";
				$ResultPopulation = mysql_query($queryPopulation);
				$i=1;
				while($rowPopulation = mysql_fetch_array($ResultPopulation))
				{
				$i;
				$habitation_name=$rowPopulation['habitation_name'];
				$habitation_code=$rowPopulation['habitation_code'];
				$total_population=$rowPopulation['total_population'];
			    $sc_population=$rowPopulation['sc_population'];
			    $st_population=$rowPopulation['st_population'];
			    $sc_st_population=$sc_population + $st_population;
			    $current_population=round($total_population*$population_factor);
				$HPCount=sourceType($habitation_code,$habitation_name,'HpGovt%');
			if($total_population!=0)
			{
				if(($sc_st_population/$total_population)>0.5)
				{
				  if(($sc_population/$sc_st_population)>0.5)
				  {
					$column13="SC";
				  }else{
				    $column13="ST";
				    }
				}
				else
				{
					$column13="GEN";
				}
			}
			else
			{
			       $column13="NONE";	
			} //end of column13
			
$queryWater="SELECT b.water_supply FROM tbl_dtls_q1_last b,tbl_dtls_q1_oh a where a.loc_id=b.loc_id and a.habit_code='$habitation_code'";
				  $ResultWater = mysql_query($queryWater);
				  $rowWater = mysql_fetch_row($ResultWater);
						if($schemeDetails == "HP")
		                     {
							 $Supply_data=($HPCount*10*1000)/$current_population;
							 }elseif($schemeDetails != "HP" && $i == 1)
									  {
									  $Supply_data=(($rowWater[0]+($HPCount*10))*1000)/$current_population;
									  }elseif($schemeDetails != "HP" && $i != 1)
									    {
								        $Supply_data=($HPCount*10*1000)/$current_population;
									    }
			
		?>	
          <td height="26" colspan="2" align="center">&nbsp;</td>
          <td align="center"><span class="style10"><?php echo $habitation_name;?></span></td>
          <td colspan="3" align="center">&nbsp;</td>
          <td align="center"><span class="style10"><?php echo $total_population;?></span></td>
          <td align="center"><span class="style10"><?php echo $current_population;?></span></td>
          <td align="center"><span class="style10"><?php echo $column13;?></span></td>
          <td colspan="4" align="center">&nbsp;</td>
          <td align="center"><span class="style10">
		  <?php
				
				if(($column16 == "HP" || $column16 != "HP") && ($schemeDetails != "HP")  && ($schemeDetails != ""))
				{
					echo "NA";
				}
			
				if(($column16 == "HP" || $column16 == "P&T" || $column16 == "Piped") && ($schemeDetails =="HP")  && ($schemeDetails != ""))
				{
					if($column13 =="GEN")
					{
						echo ceil($current_population/250);
					}
					else
					{
						echo ceil($current_population/100);
					}
				}
				
			?>
				</span></td>
          <td align="center"><span class="style10"><?php echo $HPCount;?></span></td>
          <td align="center"><span class="style10">
		  <?php
				  if($schemeDetails != "HP")
				    {
					$qryYeild="SELECT yield_min FROM tbl_dtls_q1_sws a,tbl_dtls_q1_oh b where a.loc_id=b.loc_id and b.habit_code='$habitation_code' and a.source='Tube-Well'";
                    $recYeild=mysql_query($qryYeild);
                    $rowYeild=mysql_fetch_array($recYeild);
					$minYeild=$rowYeild['yield_min'];
					$x=($minYeild*8)*1000;
					if($x == 0)
					{
					echo "0";
					}else{
					echo ceil(($current_population*$lpcd)/$x);
					}
				    }
			?>
		  </span></td>
          <td align="center"><span class="style10"><?php echo sourceType($habitation_code,$habitation_name,'TW%');?></span></td>
          <td align="center">&nbsp;</td>
          <td align="center">&nbsp;</td>
          <td align="center">&nbsp;</td>
          <td align="center"><span class="style10"><?php echo $lpcd;?></span></td>
          <td align="center"><span class="style10"><?php echo ceil($Supply_data);?></span></td>
          <td align="center"><span class="style10">
                  <?php
								   if($lpcd < ceil($Supply_data))
								   {
								   echo "+";
								   }else{
								   echo "-";
								   }
				  ?>
                </span></td>
          <td align="center"><span class="style10"><?php echo ceil(((ceil($Supply_data)-$lpcd)*100)/$lpcd); ?></span></td>
          <td align="center"><span class="style10">
		                    <?php 
								   if($column13 == "SC" ||  $column13 == "ST")
								   {
								    echo $lpcd;
								   }
						     ?></span></td>
          <td align="center"><span class="style10">
                                 <?php  
								   if($column13 == "SC" ||  $column13 == "ST")
								   {
								    echo ceil($Supply_data);
								   } 
								   ?>
                </span></td>
          <td align="center"><span class="style10">
                                  <?php
								   if($column13 == "SC" ||  $column13 == "ST")
								   {
								   if($lpcd < ceil($Supply_data))
								   {
								   echo "+";
								   }else{
								   echo "-";
								   }
								   }
								   ?>
                </span></td>
          <td colspan="4" align="center">&nbsp;</td>
          <td align="center"><span class="style10"><?php if($Supply_data > 40){ ?><img src="images/right1.jpeg" width="10" height="10">  <?php } else echo '';?></span></td>
          <td align="center"><span class="style10"><?php if(($Supply_data <= 40) && ($Supply_data >= 20)){ ?><img src="images/right1.jpeg" width="10" height="10">  <?php } else echo '';?></span></td>
          <td align="center"><span class="style10"><?php if($Supply_data < 20){ ?><img src="images/right.jpeg" width="10" height="10">  <?php } else echo '';?></span></td>
          <td align="center">&nbsp;</td>
		  <td align="center">&nbsp;</td>
        </tr>
        <?php $i++;} } ?>
      </table></td>
	</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>